
export default {
  ADD_VISITED_VIEW: (state, view) => {
    if (state.visitedViews.some(v => v.params.goodsNo === view.params.goodsNo)) return
    state.visitedViews.push(
      Object.assign({}, view, {
        title: view.params.partnerName || 'no-name'
      })
    )
  },
  ADD_CACHED_VIEW: (state, view) => {
    if (state.cachedViews.includes(view.params.goodsNo ? view.params.goodsNo : 'undefined')) return
    state.cachedViews.push(view.params.goodsNo ? view.params.goodsNo : 'undefined')
  },

  DEL_VISITED_VIEW: (state, view) => {
    for (const [i, v] of state.visitedViews.entries()) {
      if (v.params.goodsNo === view.params.goodsNo) {
        state.visitedViews.splice(i, 1)
        break
      }
    }
  },
  DEL_CACHED_VIEW: (state, view) => {
    for (const i of state.cachedViews) {
      if (i === view.params.goodsNo) {
        const index = state.cachedViews.indexOf(i)
        state.cachedViews.splice(index, 1)
        break
      }
    }
  },
  SET_RECEIVENO: (state, value) => {
    state.receiveNo = value
  },
  SET_STATUS: (state, value) => {
    state.status = value
  },
  SET_EIID: (state, value) => {
    state.id = value
  },
  UPDATE_IMAGE: (state, value) => {
    state.imageShowVisible = value
  },
  UPDATE_ADDR: (state, value) => {
    state.changeAddrVisible = value
  }
}
